package com.binguo.wxapi.wxpay;

import com.github.wxpay.sdk.WXPayConfig;
import org.springframework.core.io.DefaultResourceLoader;

import java.io.IOException;
import java.io.InputStream;

public class WXServerPayConfig implements WXPayConfig {
    @Override
    public String getAppID() {
        return WXServerPayService.appid;
    }

    @Override
    public String getMchID() {
        return WXServerPayService.mch_id;
    }

    @Override
    public String getKey() {
        return WXServerPayService.appKey;
    }

    @Override
    public InputStream getCertStream() {
        org.springframework.core.io.Resource resource = new DefaultResourceLoader().getResource("classpath:/cert/apiclient_cert.p12");//P12文件目录
        try {
            return resource.getInputStream();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public int getHttpConnectTimeoutMs() {
        return 0;
    }

    @Override
    public int getHttpReadTimeoutMs() {
        return 0;
    }
}
